Set ANSI_NULLS ON
Set QUOTED_IDENTIFIER ON
GO

/*Drop stored procedures if they exists */

IF EXISTS (SELECT name FROM sysobjects WHERE name = 'verificarNombreGrupodeMaterial' and type = 'P')

	BEGIN
		DROP PROCEDURE verificarNombreGrupodeMaterial
	END

GO

CREATE PROCEDURE verificarNombreGrupodeMaterial ( @nombreGrupodeMaterial VARCHAR (40) , 
										 @outParam INT OUTPUT						
										)
AS

	DECLARE @out AS INT;
	SET @out = -1;
	
	SELECT @out = GRUPO_MATERIAL.IDGRUPOMATERIAL
	FROM GRUPO_MATERIAL
	WHERE GRUPO_MATERIAL.NOMBREGRUPOMATERIAL = @nombreGrupodeMaterial;	 
	
	SET @outParam = @out;

	SELECT @outParam;
GO